using System;

using Atomic.Structures;

namespace Atomic.Thermodynamics.PartitionFunctions
{
	[Serializable]
	public class PartitionFunctionEntry<T> : IPartitionFunctionEntry<T>
	{
		public PartitionFunctionEntry(Composition composition, T potential, int degeneracy)
		{
			if (composition == null || potential == null)
			{
				throw new ArgumentNullException();
			}

			if (degeneracy < 0)
			{
				throw new ArgumentOutOfRangeException();
			}

			Composition = composition;
			Potential = potential;
			Degeneracy = degeneracy;
		}

		public Composition Composition
		{
			get;
			private set;
		}

		public T Potential
		{
			get;
			private set;
		}

		public int Degeneracy
		{
			get;
			private set;
		}
	}

	[Serializable]
	public class PartitionFunctionEntry : PartitionFunctionEntry<IHelmholtzPotential>, IPartitionFunctionEntry
	{
		public PartitionFunctionEntry(Composition composition, IHelmholtzPotential potential, int degeneracy)
			: base(composition, potential, degeneracy)
		{
		}
	}
}
